package com.jprocms.module.cms.service.content;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.jprocms.module.cms.dal.dataobject.content.ContentAttrDO;
import com.jprocms.module.cms.dal.mysql.content.ContentAttrMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;


/**
 * 内容自定义数据 Service 实现类
 *
 * @author jprocms
 */
@Service
@Validated
public class ContentAttrServiceImpl implements ContentAttrService {

    @Resource
    private ContentAttrMapper contentAttrMapper;

    @Override
    public void deleteByContentId(Long id) {
        LambdaQueryWrapper<ContentAttrDO> attrQueryWrapper = Wrappers.lambdaQuery(ContentAttrDO.class);
        attrQueryWrapper.eq(ContentAttrDO::getContentId, id);
        contentAttrMapper.delete(attrQueryWrapper);
    }
}
